package com.eastfair.weixin.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 微信公众号事件
 * </p>
 *
 * @author ligang
 * @since 2021-09-07
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("wx_official_event")
@ApiModel(value = "OfficialEvent", description = "微信公众号事件")
@AllArgsConstructor
public class OfficialEvent extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    @ApiModelProperty(value = "")
    @Size(max = 32, message = "长度不能超过32")
    @TableField(value = "openid", condition = LIKE)
    @Excel(name = "")
    private String openid;

    @ApiModelProperty(value = "")
    @Size(max = 64, message = "长度不能超过64")
    @TableField(value = "to_user_name", condition = LIKE)
    @Excel(name = "")
    private String toUserName;

    /**
     * 来源用户信息
     */
    @ApiModelProperty(value = "来源用户信息")
    @Size(max = 64, message = "来源用户信息长度不能超过64")
    @TableField(value = "from_user_name", condition = LIKE)
    @Excel(name = "来源用户信息")
    private String fromUserName;

    @ApiModelProperty(value = "")
    @Size(max = 32, message = "长度不能超过32")
    @TableField(value = "msg_type", condition = LIKE)
    @Excel(name = "")
    private String msgType;

    @ApiModelProperty(value = "")
    @Size(max = 64, message = "长度不能超过64")
    @TableField(value = "msg_id", condition = LIKE)
    @Excel(name = "")
    private String msgId;

    /**
     * 事件类型
     */
    @ApiModelProperty(value = "事件类型")
    @Size(max = 32, message = "事件类型长度不能超过32")
    @TableField(value = "event", condition = LIKE)
    @Excel(name = "事件类型")
    private String event;

    /**
     * 事件名称
     */
    @ApiModelProperty(value = "事件名称")
    @Size(max = 64, message = "事件名称长度不能超过64")
    @TableField(value = "event_key", condition = LIKE)
    @Excel(name = "事件名称")
    private String eventKey;

    /**
     * 二维码ticket
     */
    @ApiModelProperty(value = "二维码ticket")
    @Size(max = 128, message = "二维码ticket长度不能超过128")
    @TableField(value = "ticket", condition = LIKE)
    @Excel(name = "二维码ticket")
    private String ticket;

    /**
     * 二维码详细信息
     */
    @ApiModelProperty(value = "二维码详细信息")
    @Size(max = 128, message = "二维码详细信息长度不能超过128")
    @TableField(value = "action_info", condition = LIKE)
    @Excel(name = "二维码详细信息")
    private String actionInfo;

    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id")
    @TableField(value = "user_account_id")
    @Excel(name = "用户id")
    private Long userAccountId;

    /**
     * 项目ID
     */
    @ApiModelProperty(value = "项目ID")
    @TableField(value = "project_id")
    @Excel(name = "项目ID")
    private Long projectId;

    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    @TableField(value = "is_enabled")
    @Excel(name = "是否生效(默认1：可用 0:不可用)")
    private Integer isEnabled;

    /**
     * 是否删除(默认0：未删除 1:已删除)
     */
    @ApiModelProperty(value = "是否删除(默认0：未删除 1:已删除)")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除(默认0：未删除 1:已删除)")
    private Integer isDeleted;


    @Builder
    public OfficialEvent(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    String openid, String toUserName, String fromUserName, String msgType, String msgId, 
                    String event, String eventKey, String ticket, String actionInfo, Long userAccountId, Long projectId, 
                    Integer isEnabled, Integer isDeleted) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.openid = openid;
        this.toUserName = toUserName;
        this.fromUserName = fromUserName;
        this.msgType = msgType;
        this.msgId = msgId;
        this.event = event;
        this.eventKey = eventKey;
        this.ticket = ticket;
        this.actionInfo = actionInfo;
        this.userAccountId = userAccountId;
        this.projectId = projectId;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
    }

}
